home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / rpsort.zip / RPSORT.DOC < prev    next >
Text File  |  1991-09-17  |  87KB  |  1,949 lines

  1.  
  2.  
  3.   September 17, 1991           RPSORT Reference                      Page   i
  4.  
  5.  
  6.                                Table of Contents
  7.                                -----------------
  8.  
  9.   Introduction                                                              1
  10.  
  11.   How to Display RPSORT Built-in Syntax Screens                             1
  12.  
  13.   Syntax Conventions                                                        1
  14.  
  15.   How To Exit Quickly From RPSORT                                           2
  16.   Quick Exit From RPSORT When Output Goes To The Standard Output            2
  17.  
  18.   General Description of How RPSORT Does A Sort                             3
  19.  
  20.   Summary Of RPSORT Syntax                                                  4
  21.  
  22.   Details Of RPSORT Syntax                                                  5
  23.  
  24.     Options For Specifying Input And Output Files                           5
  25.       Using RPSORT As A Filter                                              5
  26.       Specifying Input And Output Files Directly                            5
  27.  
  28.     Specifying Lines Or Fixed Length Records                                6
  29.       Lines Are The Default                                                 6
  30.       /Fnnnn - Specifying Fixed Length Records                              6
  31.  
  32.     Detailed Description Of Sort Key Types Supported By RPSORT              7
  33.       Sort Keys That Are Character Strings                                  7
  34.         Default Case Insensitive Character Strings                          7
  35.         ASCII (Case Sensitive) Character Strings                            7
  36.         C Language Style Character Strings                                  7
  37.         Turbo Pascal Style Character Strings                                8
  38.       Sort Keys That Are Binary Numbers                                     8
  39.         Signed Binary Integers                                              8
  40.         Unsigned Binary Integers                                            9
  41.         BASICA And GWBASIC Floating Point Numbers                           9
  42.         Turbo Pascal Real Numbers                                           9
  43.         Math Co-Processor Floating Point Numbers                           10
  44.  
  45.     Defining The Desired Sort Sequence To RPSORT                           11
  46.       Standard Defaults For Sort Keys                                      11
  47.       Switches Which Set Defaults For Sort Keys                            11
  48.         /A - Sort all Text Keys in ASCII (Case Sensitive) Sequence         11
  49.         /C - Make All Text Keys Be C Language Strings                      11
  50.         /P - Make All Text Keys Be Turbo Pascal Strings                    11
  51.         /R - Sort All Keys In Reverse (Descending Order)                   11
  52.  
  53.  
  54.  
  55.   September 17, 1991           RPSORT Reference                      Page  ii
  56.  
  57.  
  58.                          Table of Contents (continued)
  59.                          -----------------------------
  60.  
  61.       Defining Sort Keys                                                   12
  62.         Sort Key Definition Syntax                                         12
  63.         Col - The Start Column For A Key                                   12
  64.         Len - The Length Of A Key                                          12
  65.         R   - Sorting The Key In Reverse (Descending) Order                12
  66.         A   - Sorting The Key In ASCII (case insensitive) Order            12
  67.         C   - Specifying A C Language Type String                          12
  68.         P   - Specifying A Turbo Pascal Type String                        12
  69.         I   - Specifying A Signed Binary Integer                           13
  70.         U   - Specifying An Unsigned Binary Integer                        13
  71.         F   - Specifying A Math Co-processor Type Floating Point Number    13
  72.         M   - Specifying A BASIC Interpretor Type Floating Point Number    13
  73.         T   - Specifying A Turbo Pascal Type Real Number                   13
  74.         List Of Various Compiler And Interpreter Numeric Data Types        14
  75.  
  76.     Miscellaneous Switches                                                 15
  77.       /Q - Suppressing Copyright And Completion Messages                   15
  78.       /Eerrfile - Directing Error Messages To A File                       15
  79.       /B - Ignoring Control Breaks Entered From The Keyboard               15
  80.       /D - Delete Records Whose Sortkeys Duplicate Previous Record         15
  81.       /N - Delete Null Lines                                               16
  82.       /Td - Designate Drive To Be Used For Temporary Files.                16
  83.       /Z - Ignore Ctrl-Z In Text File.  Use Entire Physical File.          16
  84.  
  85.   Efficiency Considerations                                                17
  86.     Do ASCII Sort If Text Keys Are All Upper Case Or All Lower Case        17
  87.     How Memory Size Affects RPSORT Speed And Need For Temp Disk Space      18
  88.       Using CHKDSK Or MEM To Determine Free Memory                         18
  89.       Sorts Requiring No Merge Phase And No Temporary Files                19
  90.       Sorts Requiring One Merge Phase And One Temporary File               20
  91.       Sorts Requiring Two Or More Merge Phases And Two Temporary Files     21
  92.     Deciding What Drives To Put Temporary And Output Files On              21
  93.     Buffers Command In Your Config.Sys                                     22
  94.     Using Disk Cache Programs                                              22
  95.  
  96.   Special Situations                                                       23
  97.     Sorting Files That Contain Tabs                                        23
  98.     Writing The Output To The File That Contained The Input                24
  99.  
  100.   Two Incompatibilities With The DOS SORT                                  24
  101.  
  102.   Error Messages                                                           25
  103.     Error Numbers And Return Codes                                         25
  104.     Syntax Error Messages                                               26-30
  105.     DOS Version Before 2.0 Message                                         31
  106.     Insufficient Memory Messages                                           31
  107.     Line Or String Too Long Messages                                       31
  108.     Input/Output Error Messages                                         32-33
  109.     Never Should Happen Error Messages                                     33
  110.  
  111.  
  112.  
  113.   September 17, 1991           RPSORT Reference                      Page   1
  114.  
  115.  
  116.   Introduction
  117.  
  118.     RPSORT is a sort utility that greatly improves upon the features and the
  119.     performance of the sort utility distributed with Microsoft DOS.  First,
  120.     RPSORT does everything that the DOS SORT does.  Virtually any command
  121.     that works with DOS SORT works with RPSORT and produces the same result.
  122.  
  123.     But RPSORT does much more.  It can sort very large files and supports
  124.     multiple sort keys.  It is extremely fast.  I do not know of another sort
  125.     utility that can outspeed it.
  126.  
  127.     RPSORT sorts text files.  These consist of lines each ended by CRLF (i.e.
  128.     a carriage return and line feed).  RPSORT also sort files of fixed length
  129.     records such as those produced by many BASIC, Pascal and C programs.
  130.  
  131.     RPSORT supports numerous sort key types including regular text keys, C
  132.     language strings, Turbo Pascal strings, signed and unsigned binary
  133.     integers of any length and several types of binary floating point numbers.
  134.  
  135.     RPSORT can delete null lines (consisting only of a CRLF).  It can also
  136.     delete records/lines whose sort keys duplicate those in a previous
  137.     record/line.
  138.  
  139.     A summary of RPSORT syntax appears on page 4 of this document.
  140.     A comprehensive list of RPSORT examples can be found in the file
  141.     EXAMPLES.DOC.
  142.  
  143.  
  144.   How to Display RPSORT Built-in Syntax Screens
  145.  
  146.     Enter the RPSORT command with no parameters, to see RPSORT's built-in
  147.     syntax screens.  Use the Page Down and Page Up keys to negotiate the
  148.     screens.  Press the Esc key when you are finished viewing the syntax
  149.     screens.
  150.  
  151.  
  152.   Syntax Conventions
  153.  
  154.   . Items in square brackets ([]) are optional.  Type the information inside
  155.     the brackets but not the brackets themselves.
  156.  
  157.   . An item followed by an ellipsis (...) may be repeated several times.
  158.  
  159.   . Capital letters (A thru Z) and special characters (/ and ? and +) should
  160.     be entered as they appear in the syntax except that you may enter lower
  161.     case letters in place of the capital letters.
  162.  
  163.   . Words spelled out in lower case letters describe an item you are to enter.
  164.     For example, where you see the word "inputfile" in the syntax, enter the
  165.     path (if necessary) and the name of an input file.  File names and other
  166.     and other parameters may be entered in lower or upper case as you choose.
  167.  
  168.  
  169.  
  170.   September 17, 1991           RPSORT Reference                      Page   2
  171.  
  172.  
  173.   How To Exit Quickly From RPSORT
  174.  
  175.     RPSORT is very fast and can sort files containing hundreds of kilobytes
  176.     and thousands of records in just a few seconds (I am assuming a 286 CPU
  177.     and a hard disk).  However, if you are sorting a really large file (say
  178.     20 megabytes) then the execution time could be a some number of minutes.
  179.     If you start such a sort and then realize that you specified the wrong
  180.     sort key(s), you can terminate the sort immediately as follows:
  181.  
  182.     . Enter a Ctrl-Break (i.e. hold down the Ctrl key press the Break key).
  183.  
  184.     . Within a very few seconds, RPSORT will respond with the message:
  185.  
  186.         Do you wish to quit RPSORT?  Press Esc to quit, any other key to
  187.         continue.
  188.  
  189.     . If you do indeed wish to terminate the sort press the Esc key.  RPSORT
  190.       will clean up properly by deleting any temporary files as well as any
  191.       partial output file and then it will terminate.
  192.  
  193.     . If you decide you don't want to terminate the sort after all, press any
  194.       key but the Esc key and the sort will continue.
  195.  
  196.     After terminating the sort, as above, you can then re-enter the RPSORT
  197.     command with the correct parameters.
  198.  
  199.     There might be other reasons to terminate the sort.  Perhaps you need the 
  200.     computer for some other purpose and can't wait for the sort to finish.
  201.     In such cases, be aware that any work done by RPSORT will be lost.  If
  202.     you do the sort later on you will have to start it from the beginning.
  203.  
  204.     If you want RPSORT to ignore any control break, use the /B switch.  See
  205.     "Miscellaneous Switches" on page 15.
  206.  
  207.  
  208.   Quick Exit From RPSORT When Output Goes To The Standard Output
  209.  
  210.     If RPSORT is writing its output to the standard output, as in:
  211.  
  212.       RPSORT    <inputfile  >outputfile
  213.  
  214.     then the termination proceeds a little differently:
  215.  
  216.     . As above you enter Ctrl-Break.
  217.  
  218.     . RPSORT simply terminates the sort within a few seconds without giving
  219.       you a chance to change your mind.  As above it deletes any temporary
  220.       files but it does not delete the output file.  It can't delete the
  221.       latter because it doesn't know the name of a redirected output file.
  222.  
  223.  
  224.  
  225.   September 17, 1991           RPSORT Reference                      Page   3
  226.  
  227.  
  228.   General Description of How RPSORT Does A Sort
  229.  
  230.     When you execute RPSORT you specify in the command line:
  231.  
  232.     . The source of the input data (one or more files) and the destination
  233.       for the sorted output (either a file or the screen).
  234.  
  235.     . Whether the input is lines terminated by CRLF or fixed length records.
  236.  
  237.     . Optionally, you define one or more sort key.  These indicate:
  238.  
  239.       . The location of the key in the line or record.
  240.       . The length of the key.
  241.       . The type of key. Any of several string or numeric types.
  242.  
  243.       If there are no sort key definitions, RPSORT assumes a default
  244.       character string key consisting of the entire line or record.
  245.  
  246.     The sort process involves the following:
  247.  
  248.     . RPSORT compares two records/lines, at a time, to determine which comes
  249.       first and swaps them, if necessary, to put them in the right sequence.
  250.       The comparisons continue until the entire input has been sequenced.
  251.  
  252.     . RPSORT uses the quicksort algorithm (invented by C. A. R. Hoare in
  253.       1962) to determine which records/lines to compare.  This algorithm is
  254.       very good at doing the sort with the minimum number of comparisons.
  255.  
  256.     . In comparing two records/lines, RPSORT compares the sort keys in the
  257.       same sequence as their appearance in the command line until it finds an
  258.       unequal compare or runs out of sort keys.
  259.  
  260.     . If all the sort keys are equal for two records, RPSORT breaks the tie
  261.       by comparing the locations of the two records in the input.  This
  262.       maintains any inherent order in the file (i.e. if two or more records
  263.       have identical sort keys then their order among themselves in the
  264.       sorted output will be the same as it was in the input).
  265.  
  266.     . For files consisting of lines, some of the lines may be:
  267.  
  268.       . Too short to contain any part of a given sort key.  Then, the sort
  269.         keyis taken to be a null string and sorts lower than anything else.
  270.  
  271.       . Or too short to contain the whole sort key.  Then, the key comparison
  272.         is done for the length of the shorter key.  If the keys are equal for
  273.         that length, the shorter key sorts low.
  274.  
  275.     . If the input file(s) are small enough to fit in the available memory
  276.       space the sort is done in one pass in memory.
  277.  
  278.     . If the input is too big to fit into memory, it is read in chunks and
  279.       each chunk is sorted and written to a temp file.  Then RPSORT uses one
  280.       or more merge phases to combine the chunks into the sorted output file.
  281.  
  282.  
  283.  
  284.   September 17, 1991           RPSORT Reference                      Page   4
  285.  
  286.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  287.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  288.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  289.  
  290.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  291.  
  292.  
  293.   Summary Of RPSORT Syntax
  294.  
  295.   Input is one or more filespecs (including path if required) separated by
  296.   plus signs.  Output is a single filespec.  Input filespec(s) must precede
  297.   output filespec.  Wildcard characters are not allowed.  Input file(s) are
  298.   sorted together into the single output file.  For example:
  299.  
  300.       RPSORT  IPFILE1.DAT+IPFILE2.TXT+C:\MYDIR\IPFILE3.DAT   OPFILE.DAT
  301.  
  302.   RPSORT can also be used as a filter.  For example:
  303.  
  304.           RPSORT   <IPFILE   >OPFILE
  305.  
  306.   By default, RPSORT assumes a text file with the entire line as a case
  307.   insensitive sort key.  This can be changed by some of the parameters below.
  308.  
  309.   /Q suppresses copyright and success messages.  Must be first parameter.
  310.   /Eerrfile specifies file to which error messages will go instead of the
  311.      screen.  Should precede any parameter except /Q.
  312.   /? or ? displays built-in syntax screens.
  313.   /A does an ASCII sort.  Case sensitive (lower case not equal upper case).
  314.   /B tells RPSORT to ignore any control break entered from the keyboard.
  315.   /C specifies C language style text keys (terminated by a binary zero).
  316.   /D deletes any record whose sortkeys duplicate those in a previous record.
  317.   /Fnnnn says that the input consists of fixed length records of nnnn bytes.
  318.   /N deletes any null lines (those consisting only of a CRLF sequence).
  319.   /P specifies Pascal style text keys (first byte is length of string).
  320.   /R specifies a reverse (descending order) sort.
  321.   /Td designates drive to be used for temp files instead of default drive.
  322.   /Z tells RPSORT to ignore Ctrl-Z in text file and use the entire file.
  323.   The /R switch applies to all sort keys.  The /A, /C and /P switches apply to
  324.   all text sort keys.  They can't be over-ridden for an individual sort key.
  325.  
  326.   A sort key definition starts with /+ and may include the following
  327.   attributes.  No spaces are allowed between the attributes:
  328.  
  329.   col   is starting column of this key. Col 1 is the first col in the record.
  330.   :len  is the length of this key.
  331.   A     does an ASCII (case sensitive) sort for the key.
  332.   C     sorts this key as C language text key (terminated by a binary zero).
  333.   F     sorts this key as a 80x87 floating point number.  Len is 4, 8 or 10.
  334.   I     sorts this key as a signed binary integer.  This may be any length.
  335.   M     sorts this key as a BASICA floating point number.  Len is 4 or 8.
  336.   P     sorts this key as Pascal text key (first byte is length of string).
  337.   R     does a reverse (descending) sort for this key.
  338.   T     sorts this key as a Turbo Pascal type "real" number.  Len must be 6.
  339.   U     sorts this key as an unsigned binary integer. This may be any length.
  340.   Attributes F, I, M, P, T and U are only allowed for fixed length records.
  341.  
  342.  
  343.  
  344.   September 17, 1991           RPSORT Reference                      Page   5
  345.  
  346.  
  347.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  348.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  349.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  350.  
  351.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  352.  
  353.   Details Of RPSORT Syntax
  354.  
  355.     There are three types of parameters:
  356.  
  357.     . Those that specify files (i.e inputfile and outputfile).
  358.     . Switches which consist of a slash and a letter plus possibly a file
  359.       name, number or drive letter (e.g /Q, /Eerrfile, /Fnnnn, Td).
  360.     . Sort key definitions each of which defines a single sort key.
  361.  
  362.     The parameters can be entered in any sequence except that:
  363.  
  364.     . The inputfile(s) must always precede the outputfile.
  365.     . The /Q switch (see /Q - Suppressing Copyright And Completion Messages)
  366.       must precede any other parameter.
  367.     . The /Eerrfile switch (see /Eerrfile - Directing Error Messages To A
  368.       File) should precede everything but /Q.
  369.  
  370.     Options For Specifying Input And Output Files
  371.  
  372.       Using RPSORT As A Filter
  373.  
  374.         RPSORT can be used as a filter which reads the standard input and
  375.         writes to the standard output.  For example:
  376.  
  377.               RPSORT   <ipfile   >opfile
  378.  
  379.         The standard output need not be redirected and can go to the screen.
  380.         The standard input must be redirected to a file or piped from the
  381.         output of another program.  RPSORT will not accept an input file
  382.         directly from the keyboard.  If you take the input from the standard
  383.         input then the output MUST go to the standard output.
  384.  
  385.       Specifying Input And Output Files Directly
  386.  
  387.         You can specify the input and output files directly.  Input is one or
  388.         more files separated by plus signs but output must be a single file.
  389.         The filespecs may include a path.  Wildcard characters are not
  390.         allowed in any file name.  All input files are combined and sorted
  391.         together into the single output file.  For example:
  392.  
  393.           RPSORT  IPFILE1.DAT+IPFILE2.DAT+C:\MYDIR\IPFILE3.DAT   OPFILE.DAT
  394.  
  395.         If the path and filename for the output filespec are the same as that
  396.         for an existing file, the latter will be replaced by the output from
  397.         RPSORT.  If this is what you want, fine but if you don't want to lose
  398.         the existing file then use a different name for the output.
  399.  
  400.  
  401.  
  402.   September 17, 1991           RPSORT Reference                      Page   6
  403.  
  404.  
  405.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  406.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  407.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  408.  
  409.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  410.  
  411.  
  412.     Specifying Lines Or Fixed Length Records
  413.  
  414.       Lines Are The Default
  415.  
  416.         By default, the file is assumed to consist of lines.  A line is a
  417.         sequence of characters terminated by CRLF.  RPSORT also accepts the
  418.         LFCR sequence as a line terminator.  The lines may vary in length
  419.         from null lines up to a maximum length of 32750.  RPSORT will reject
  420.         a file that contains a line longer than this.
  421.  
  422.         If the last record in an input file does not terminate with CRLF or
  423.         LFCR,  RPSORT will append these two characters and display a message
  424.         informing you of its action.
  425.  
  426.         If the input is two or more files, RPSORT will, if necessary, append
  427.         a CRLF to terminate the last line in each of the files.  RPSORT never
  428.         assumes that a line starting in one file continues in the next.
  429.  
  430.         Only character string sort keys are allowed in a file of lines.
  431.         Binary numeric sort keys are not allowed.
  432.  
  433.  
  434.       /Fnnnn - Specifying Fixed Length Records
  435.  
  436.         A file of fixed length records contains records all of the same
  437.         length.  The /Fnnnn switch tells RPSORT that the records are fixed
  438.         length and the value you enter for nnnn specifies the length.  For
  439.         example, /F65 tells RPSORT that the file consists of 65 byte records.
  440.  
  441.         Fixed length records need not end with a CRLF but if they do, those
  442.         two bytes must be included in the length given by the /Fnnnn switch.
  443.  
  444.         The maximum length you may specify is 32750.  RPSORT would reject
  445.         /F32751.
  446.  
  447.         If the last record in the input is shorter than the length given in
  448.         the /Fnnnn switch (i.e. the file length is not an exact multiple of
  449.         nnnn), RPSORT ignores the last record and does not include it in the
  450.         sorted output.  RPSORT displays a message to inform you of its action.
  451.  
  452.         If the input consists of two or more files, RPSORT will skip last
  453.         short records from each of the input files.  RPSORT never assumes
  454.         that a record starting in one file continues in the next.
  455.  
  456.         All key types supported by RPSORT are allowed in a file of fixed
  457.         length records.
  458.  
  459.  
  460.  
  461.   September 17, 1991           RPSORT Reference                      Page   7
  462.  
  463.  
  464.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  465.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  466.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  467.  
  468.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  469.  
  470.  
  471.     Detailed Description Of Sort Key Types Supported By RPSORT
  472.  
  473.       Sort Keys That Are Character Strings
  474.  
  475.         Default Case Insensitive Character Strings
  476.  
  477.           This is the only sequence supported by the DOS SORT.  The digits 0
  478.           through 9 come before the letters.  Lower case letters sort equal
  479.           to upper case letters.  Foreign letters, punctuation and currency
  480.           symbols sort equal to their American English equivalents.
  481.  
  482.         ASCII (Case Sensitive) Character Strings
  483.  
  484.           The sequence is according to the ASCII value assigned to each
  485.           character.  This puts the digits 0 through 9 before any letters and
  486.           puts all of the upper case letters before any of the lower case
  487.           letters.  Foreign letters, punctuation and currency symbols sort
  488.           higher than any of the above.
  489.  
  490.           The ASCII value for each character is the code used internally by
  491.           the computer to represent that character.  An ASCII sort is the
  492.           fastest possible sort because it requires no pre-processing of the
  493.           characters.
  494.  
  495.           You can specify this type of sort key by using either the /A switch
  496.           (see page 11) or the A attribute (see page 12).
  497.  
  498.         C Language Style Character Strings
  499.  
  500.           C language strings are allocated some maximum length in your C
  501.           program.  This should be the length in the sort key definition.
  502.  
  503.           For example, if you define "char mystr[8]" in your C program then
  504.           the compiler allocates 8 bytes and therefore the length specified
  505.           to RPSORT should also be 8.
  506.  
  507.           The actual character string, however, may be shorter.  C language
  508.           strings are terminated by a binary zero if they do not fill the
  509.           allocated space.  Therefore, RPSORT takes the length of a C style
  510.           string to be the lesser of:
  511.  
  512.           . The length attribute (or if absent the default length).
  513.           . The length up to but not including the first binary zero.
  514.  
  515.           You can specify this type of sort key by using either the /C switch
  516.           (see page 11) or the C attribute (see page 12).
  517.  
  518.  
  519.  
  520.   September 17, 1991           RPSORT Reference                      Page   8
  521.  
  522.  
  523.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  524.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  525.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  526.  
  527.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  528.  
  529.  
  530.     Detailed Description Of Sort Key Types Supported By RPSORT (continued)
  531.       Sort Keys That Are Character Strings (continued)
  532.  
  533.         Turbo Pascal Style Character Strings
  534.  
  535.           Turbo Pascal strings are allocated some maximum length in your
  536.           Pascal program.  This should be the length given in the sort key
  537.           definition.
  538.  
  539.           For example, if you define string[8] in your Pascal program then 
  540.           the compiler allocates 9 bytes to the string and therefore the
  541.           length specified to RPSORT should also be 9.
  542.  
  543.           The first byte in a Pascal string is a length byte.  This contains
  544.           a binary number which is the actual length of the string.  The
  545.           remaining bytes allow enough room for the longest possible string.
  546.  
  547.           The length must be between 2 and 256 inclusive.  These limits
  548.           correspond to string[1] and string[255] respectively.
  549.  
  550.           If RPSORT finds a length byte value, in the file, that is too large
  551.           (i.e. greater than or equal to the specified length) it aborts.
  552.           This would only occur if the sort key was incorrectly defined.
  553.  
  554.           You can specify this type of sort key by using either the /P switch
  555.           (see page 11) or the P attribute (see page 12).  This type of sort
  556.           key is only allowed for fixed length records.
  557.  
  558.  
  559.       Sort Keys That Are Binary Numbers
  560.  
  561.         Signed Binary Integers
  562.  
  563.           A signed binary integer is a two's complement binary integer that
  564.           is stored low byte first, high byte last.
  565.  
  566.           This is the natural way for an 80X86 CPU to store binary integers.
  567.           As far as I know, all language compilers and interpreters for IBM
  568.           PCs and clones store them this way.
  569.  
  570.           RPSORT allows signed binary integer sort keys to be any length from
  571.           1 up to the length of the record.
  572.  
  573.           You can specify this type of sort key by using the I attribute (see
  574.           page 13).  This type of sort key is only allowed for fixed length
  575.           records.
  576.  
  577.  
  578.  
  579.   September 17, 1991           RPSORT Reference                      Page   9
  580.  
  581.  
  582.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  583.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  584.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  585.  
  586.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  587.  
  588.  
  589.     Detailed Description Of Sort Key Types Supported By RPSORT (continued)
  590.       Sort Keys That Are Binary Numbers (continued)
  591.  
  592.         Unsigned Binary Integers
  593.  
  594.           Unsigned binary integers, just like signed binary integers, are
  595.           stored low byte first, high byte last.
  596.  
  597.           RPSORT allows unsigned binary integer sort keys to be any length
  598.           from 1 up to the length of the record.
  599.  
  600.           You can specify this type of sort key by using the U attribute (see
  601.           page 13).  This type of sort key is only allowed for fixed length
  602.           records.
  603.  
  604.         BASICA And GWBASIC Floating Point Numbers
  605.  
  606.           RPSORT supports binary floating point numbers as defined by the
  607.           BASIC interpreter (prior to MS-DOS v5.0) and older versions of
  608.           Microsoft QuickBASIC (prior to QB v4.0).  The lengths that RPSORT
  609.           will accept for these numbers are:
  610.  
  611.             Length = 4 for single precision numbers.
  612.             Length = 8 for double precision numbers.
  613.  
  614.           You can specify this type of sort key by using the M attribute (see
  615.           page 13) and one of the lengths listed above.  This type of sort 
  616.           key is only allowed for fixed length records.
  617.  
  618.         Turbo Pascal Real Numbers
  619.  
  620.           RPSORT supports Turbo Pascal numbers of type "real".  The length
  621.           need not be specified and is always 6.
  622.  
  623.           You can specify this type of sort key by using the T attribute (see
  624.           page 13).  This type of sort key is only allowed for fixed length
  625.           records.
  626.  
  627.           This was the "real" type in the original version of Turbo Pascal
  628.           and is still supported in version 6.0.  To see how to sort the new
  629.           80x87 formats in Turbo Pascal (single, double, extended and comp)
  630.           refer to the table on page 14.  Also see the next section on "Math
  631.           Co-Processor Floating Point Numbers".
  632.  
  633.  
  634.  
  635.   September 17, 1991           RPSORT Reference                      Page  10
  636.  
  637.  
  638.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  639.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  640.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  641.  
  642.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  643.  
  644.  
  645.     Detailed Description Of Sort Key Types Supported By RPSORT (continued)
  646.       Sort Keys That Are Binary Numbers (continued)
  647.  
  648.         Math Co-Processor Floating Point Numbers
  649.  
  650.           RPSORT supports three types of math co-processor (i.e. 80x87) 
  651.           floating point numbers.  The table below gives the lengths and
  652.           names assigned to them by Intel and by three popular compilers.
  653.  
  654.            Length    Intel         QuickBasic    Turbo Pascal    Turbo C
  655.            ------    ----------    ----------    ------------    -------
  656.               4      short real    single        single          float
  657.               8      long  real    double        double          double
  658.              10      temp  real    N/A           extended        long double
  659.  
  660.           You can specify this type of sort key by using the F attribute (see
  661.           page 13) and one of the lengths listed above.  This type of sort
  662.           key is only allowed for fixed length records.
  663.  
  664.           RPSORT does not require a math co-processor to sort numbers of this
  665.           type and does not use the 80x87 even if it is present.
  666.  
  667.           Zero values returned by an 80x87 are marked as either a +0 or a -0.
  668.           Some zero values arise from underflow.  This occurs if a result is
  669.           too small (i.e. has too negative an exponent) for the given numeric
  670.           format (short real, long real or temp real).  The 80x87 returns a
  671.           zero result but keeps the sign of the small number.
  672.  
  673.           RPSORT sorts minus zeros as less than plus zeros.  I could call
  674.           this a deliberate feature in that it reflects as best as possible
  675.           the true sequence of very small results but actually it's a natural
  676.           consequence of the way I do the sort.
  677.  
  678.           A result can be too large for the given numeric format.  This is
  679.           called overflow.  Most compilers generate an error and do not store
  680.           store a result but an 80x87 can return special values denoting
  681.           plus and minus infinity.  RPSORT sorts plus infinity higher than
  682.           any other value and minus infinity as lower than any other value.
  683.  
  684.           The 80x87 also generates special values for error conditions (e.g.
  685.           taking the square root of a negative number).  Any compiler would
  686.           generate an error rather than store such values.  Still, RPSORT
  687.           must do something if it finds them.  I sort them the same as plus
  688.           or minus infinity depending on their sign.
  689.  
  690.  
  691.  
  692.   September 17, 1991           RPSORT Reference                      Page  11
  693.  
  694.  
  695.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  696.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  697.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  698.  
  699.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  700.  
  701.  
  702.     Defining The Desired Sort Sequence To RPSORT
  703.  
  704.       Standard Defaults For Sort Keys
  705.  
  706.         The following defaults are used by RPSORT unless you specify other
  707.         defaults (see "Switches Which Set Defaults For Sort Keys") or specify
  708.         different attributes in the sort key definition for a sort key (see
  709.         "Defining Sort Keys").
  710.  
  711.         . The sort key consists of the entire record/line.
  712.  
  713.         . The sort key is a character string to be sorted per the same case
  714.           insensitive sequence used by the DOS SORT.  Digits 0 through 9
  715.           precede the letters.  Lower case letters sort equal to upper case.
  716.           Foreign letters,  punctuation and currency symbols sort equal to
  717.           their American English equivalents.
  718.  
  719.         . The sort will be in ascending (low to high) sequence.
  720.  
  721.  
  722.       Switches Which Set Defaults For Sort Keys
  723.  
  724.         These switches change some of the defaults for sort keys.  They can't
  725.         be over-ridden by individual sort key definitions.  Use them only if
  726.         you want all your sort keys to have the same attributes.  The /C and
  727.         /P switches may be of particular interest to computer programmers.
  728.  
  729.         The /A, /C and /P switches apply to all character string sort keys
  730.         (i.e. they apply to any sort key that is not defined as being a
  731.         binary numeric type).  /C and /P are mutually exclusive but either
  732.         may be used in conjunction with /A.
  733.  
  734.         /A  makes the ASCII (case sensitive) sequence the default.  Digits 0
  735.             through 9 precede the letters and all upper case letters precede
  736.             any lower case letters.  The sequence is per the ASCII code for
  737.             each character.
  738.  
  739.         /C  says that all string keys are C language character strings.  See
  740.             page 7 for a description of C style strings.
  741.  
  742.         /P  says that all string keys are Turbo Pascal type strings.  See
  743.             page 8 for a description of Pascal style strings.  The /P switch
  744.             is only allowed for fixed length records.
  745.  
  746.         /R  specifies a reverse sort.  The sort will be in descending (high
  747.             to low) sequence.  /R applies to all the sort keys you define.
  748.  
  749.  
  750.  
  751.   September 17, 1991           RPSORT Reference                      Page  12
  752.  
  753.  
  754.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  755.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  756.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  757.  
  758.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  759.  
  760.  
  761.       Defining Sort Keys
  762.  
  763.         Sort Key Definition Syntax
  764.  
  765.           If no sort key definitions are given, RPSORT assumes a single
  766.           default sort key (see "Standard Defaults For Sort Keys" and
  767.           "Switches Which Set Defaults For Sort Keys").
  768.  
  769.           You may specify as many sort key definitions as you like provided
  770.           that they fit within the command line (maximum of 127 bytes).  Sort
  771.           key definitions consist of a /+ followed by a list of attributes
  772.           with no spaces between them.  You may, however, use spaces to
  773.           separate one sort key definition from another or from a switch.
  774.  
  775.           All attributes are optional.  A sort key definition may be just /+,
  776.           which gets you the same default sort key as when no sort key
  777.           definitions are specified.  The following describes each of the
  778.           attributes:
  779.  
  780.           col  is the starting column for the key.  This must be at least 1
  781.                but no more than 32750.  For fixed length records, the maximum
  782.                is the largest column such that there is enough room in the
  783.                remainder of the record to hold the minimum legitimate key
  784.                length for the given key type.
  785.  
  786.          :len  is the length for this key.  The legitimate values for len
  787.                depend on the type of the sort key.
  788.  
  789.           R    specifies a reverse sort for this key.  The sequence will be
  790.                in descending (high to low) sequence.
  791.  
  792.           The next three attributes are used for character string keys.  C
  793.           and P are mutually exclusive but either may be used with A.  C and
  794.           P may be of interest to computer programmers.
  795.  
  796.           A    does an ASCII (case sensitive) sort for the key.  The digits 0
  797.                through 9 precede the letters and all upper case letters
  798.                precede any of the lower case letters.
  799.  
  800.           C    says that this key is a C language character string.  See page
  801.                7 for a description of C style strings.
  802.  
  803.           P    says that this key is a Turbo Pascal character string.  See
  804.                page 8 for a description of Pascal style character strings.
  805.                The P attribute is only allowed for fixed length records.
  806.  
  807.  
  808.  
  809.   September 17, 1991           RPSORT Reference                      Page  13
  810.  
  811.  
  812.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  813.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  814.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  815.  
  816.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  817.  
  818.  
  819.       Defining Sort Keys (continued)
  820.         Sort Key Definition Syntax (continued)
  821.  
  822.           The next five attributes define binary numeric type keys which are
  823.           only allowed for fixed length records.  They are mutually exclusive.
  824.           These attributes may be of interest to computer programmers.
  825.  
  826.           The table on page 14 lists some programming language compilers and
  827.           interpreters and indicates the appropriate type and length
  828.           attributes to be used for each of their binary numeric data types.
  829.  
  830.           I    sorts this key as a signed binary integer.  These may be any
  831.                length.  See page 8 for additional details.
  832.  
  833.           U    sorts this key as an unsigned binary integer.  These may be
  834.                any length.  See page 9 for additional details.
  835.  
  836.           F    sorts this key as a binary floating point number of the type
  837.                produced by a math co-processor (i.e. an 80x87).  RPSORT
  838.                supports three precisions for 80x87 floating point numbers.
  839.                The table below gives the lengths for each precision and the
  840.                names assigned to them by Intel and three popular compilers.
  841.  
  842.                 Length   Intel        QuickBasic   Turbo Pascal   Turbo C
  843.                 ------   ----------   ----------   ------------   -------
  844.                    4     short real   single       single         float
  845.                    8     long  real   double       double         double
  846.                   10     temp  real   N/A          extended       long double
  847.  
  848.                RPSORT does not require a math co-processor to sort numbers of
  849.                this type and does not use the 80x87 even if it is present.
  850.  
  851.                See page 10 for additional details concerning math 
  852.                co-processor floating point numbers.
  853.  
  854.           M    sorts this key as a binary floating point number as defined by
  855.                the BASIC interpreter (prior to MS-DOS v5.0) and older
  856.                versions of Microsoft QuickBASIC (prior to QB v4.0).  The len
  857.                attribute can be 4 or 8.
  858.  
  859.                Use len = 4 for single precision numbers.
  860.                Use len = 8 for double precision numbers.
  861.  
  862.           T    sorts this key as a Turbo Pascal number of type "real".  The
  863.                len parameter need not be specified and is 6 by default. See
  864.                page 9 for additional details.
  865.  
  866.  
  867.  
  868.   September 17, 1991           RPSORT Reference                      Page  14
  869.  
  870.  
  871.   The following table lists the type and length attributes for the binary
  872.   numeric types available in a few programming language compilers and
  873.   interpreters.
  874.  
  875.   If you are using a compiler that is not in this table, you should review
  876.   the previous pages along with the programmers guide for your compiler to
  877.   see if any of the binary numeric types supported by RPSORT match those
  878.   available with your compiler.
  879.  
  880.   Compiler Or Interpreter       Number Type  Type Attribute  Length Attribute
  881.   -----------------------       -----------  --------------  ----------------
  882.   Microsoft QuickBASIC          Integer             I                2
  883.    v4.0 and later &             Long                I                4
  884.   Microsoft QBASIC              Single              F                4
  885.                                 Double              F                8
  886.  
  887.   Microsoft QuickBASIC          Integer             I                2
  888.    v3.0, 8087                   Single              F                4
  889.                                 Double              F                8
  890.  
  891.   IBM BASICA &                  Integer             I                2
  892.   Microsoft GWBASIC &           Single              M                4
  893.   Microsoft QuickBASIC          Double              M                8
  894.    v1.0, v2.0 and v3.0 non-8087
  895.  
  896.   Turbo Pascal                  Shortint            I                1
  897.    v4.0 and later               Integer             I                2
  898.                                 Longint             I                4
  899.                                 Byte                U                1
  900.                                 Word                U                2
  901.                                 Real                T                6
  902.                                 Single              F                4
  903.                                 Double              F                8
  904.                                 Extended            F               10
  905.                                 Comp                I                8
  906.  
  907.   Turbo Pascal                  Integer             I                2
  908.    v3.0 8087                    Byte                U                1
  909.                                 Real                F                8
  910.  
  911.   Turbo Pascal                  Integer             I                2
  912.    v1.0, v2.0 and v3.0 non-8087 Byte                U                1
  913.                                 Real                T                6
  914.  
  915.   Borland/Turbo C               signed char         I                1
  916.                                 unsigned int        U                2
  917.                                 short int           I                2
  918.                                 int                 I                2
  919.                                 unsigned long       U                4
  920.                                 long                I                4
  921.                                 float               F                4
  922.                                 double              F                8
  923.                                 long double         F               10
  924.  
  925.  
  926.  
  927.   September 17, 1991           RPSORT Reference                      Page  15
  928.  
  929.  
  930.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  931.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  932.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  933.  
  934.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  935.  
  936.  
  937.     Miscellaneous Switches
  938.  
  939.       /Q - Suppressing Copyright And Completion Messages.
  940.  
  941.          The /Q switch, if it is the first parameter, suppresses display of:
  942.  
  943.          . The Copyright message when the sort starts.
  944.          . The "Sort successfully completed." message after successful sort.
  945.  
  946.          Error messages, if any, will still be displayed.
  947.  
  948.       /Eerrfile - Directing Error Messages To A File.
  949.  
  950.          This switch directs error and successful completion messages to the
  951.          file designated by errfile instead of the screen.  For example:
  952.  
  953.                 /Ec:\mydir\myerrors
  954.  
  955.          Specify /Enul to send error messages to the DOS NUL file which means
  956.          nowhere.  Only the /Q switch, if any, should precede the /E switch.
  957.  
  958.       /B - Ignoring Control Breaks Entered From The Keyboard.
  959.  
  960.          Tells RPSORT to ignore Ctrl-Break from the keyboard.  This would be
  961.          useful if you setup a batch file which includes RPSORT and you don't
  962.          want the users of the batch file to be able to interrupt RPSORT.
  963.  
  964.       /D - Delete Records Whose Sortkeys Duplicate Those In A Previous Record
  965.  
  966.          Tells RPSORT to delete any records/lines whose sort keys duplicate
  967.          those in a previous one.  This deletes records/lines even if they 
  968.          are not identical to a previous one since all that is required is 
  969.          that the sort keys be the same.
  970.  
  971.          To only delete identical records/lines, tack on /+a as the last sort
  972.          key.  This produces an equal compare only for identical
  973.          records/lines.  For example:
  974.  
  975.                 RPSORT /D /+1:2
  976.  
  977.          deletes any lines whose first two bytes equal those on a previous
  978.          line, while
  979.  
  980.                 RPSORT /D /+1:2 /+a
  981.  
  982.          deletes only lines that are identical to a previous line.
  983.  
  984.  
  985.  
  986.   September 17, 1991           RPSORT Reference                      Page  16
  987.  
  988.  
  989.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  990.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  991.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  992.  
  993.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  994.  
  995.  
  996.     Miscellaneous Switches (continued)
  997.  
  998.       /N - Delete Null Lines
  999.  
  1000.          This switch deletes all null lines (i.e. lines consisting only of a
  1001.          CRLF).  Lines that are all spaces and thus look like null lines when
  1002.          you list them will not be deleted.  This switch is not allowed for
  1003.          fixed length records for which it would be meaningless.
  1004.  
  1005.  
  1006.       /Td - Designate Drive To Be Used For Temporary Files.
  1007.  
  1008.          Given enough memory, RPSORT loads the entire input into memory,
  1009.          sorts it and writes the sorted data to the output file.  In such
  1010.          cases, RPSORT does not need to create any temporary files.
  1011.  
  1012.          If the input is larger than the available memory, RPSORT reads the
  1013.          file a chunk at a time, sorts each chunk and writes the sorted
  1014.          chunks to a temporary file.  RPSORT then does one or more merge
  1015.          phases to combine the chunks into a single sorted output file.
  1016.  
  1017.          RPSORT normally puts temporary files on the default drive.  The /T
  1018.          switch lets you to specify an alternate drive.  For example:
  1019.  
  1020.             /TC
  1021.  
  1022.          puts the temporary file(s) on your C drive.  See the section on
  1023.          "Efficiency Considerations" for more details.
  1024.  
  1025.  
  1026.       /Z - Ignore Ctrl-Z In Text File.  Use Entire Physical File.
  1027.  
  1028.          RPSORT (just like MS-DOS) treats Ctrl-Z as the end of a text file.
  1029.          This is usually the correct thing to do since Ctrl-Z, if present,
  1030.          normally follows the last byte of actual data.
  1031.  
  1032.          Sometimes, however, one or more Ctrl-Zs occur in the middle of a
  1033.          text file.  Files downloaded from bulletin boards may contain
  1034.          garbage characters (such as Ctrl-Z) due to a noisy line.  If you
  1035.          sort such a file, the sorted output is shorter than the original
  1036.          file because RPSORT uses only part of the input.
  1037.  
  1038.          The /Z switch tells RPSORT to ignore Ctrl-Zs and to use the entire
  1039.          input.  RPSORT deletes any Ctrl-Zs except for one at the end of the
  1040.          file.  /Z is not applicable to fixed length records where Ctrl-Z has
  1041.          no special meaning and is just taken as another data byte.
  1042.  
  1043.  
  1044.  
  1045.   September 17, 1991           RPSORT Reference                      Page  17
  1046.  
  1047.  
  1048.   Efficiency Considerations
  1049.  
  1050.     Do ASCII Sort If Text Keys Are All Upper Case Or All Lower Case
  1051.  
  1052.       An ASCII sort puts text keys in order according to the ASCII code
  1053.       assigned each of the characters.  This is the fastest possible sort
  1054.       because RPSORT can sequence records by directly comparing the sort keys
  1055.       without having to pre-process them in any way.
  1056.  
  1057.       If a file contains both upper and lower case letters and you want all
  1058.       the keys starting with a lower case "a" to be together with the keys
  1059.       starting with an upper case "A" and so on, then you can't do an ASCII
  1060.       sort and must do a case insensitive sort.
  1061.  
  1062.       However, if your file contains only upper case letters (or if it
  1063.       contains only lower case letters) then an ASCII sort will acheive the
  1064.       the same result as a case insensitive sort but will be faster.  You
  1065.       specify an ASCII sort either by using the A attribute in each sort key:
  1066.  
  1067.         RPSORT  /+1:5A  /+12:7A  INPUT.DAT  OUTPUT.DAT
  1068.  
  1069.       or by using the /A switch:
  1070.  
  1071.         RPSORT  /A  /+1:5  /+12:7  INPUT.DAT  OUTPUT.DAT
  1072.  
  1073.       If your files contain foreign letters, punctuation or currency symbols
  1074.       and you want these to sort the same as their American English
  1075.       equivalents then you must do a case insensitive sort.
  1076.  
  1077.  
  1078.  
  1079.   September 17, 1991           RPSORT Reference                      Page  18
  1080.  
  1081.  
  1082.   Efficiency Considerations (continued)
  1083.  
  1084.     How Memory Size Affects RPSORT Speed And Need For Temp Disk Space
  1085.  
  1086.       The amount of memory (I mean conventional memory not Expanded or
  1087.       Extended memory) affects RPSORT's speed in the following ways:
  1088.  
  1089.       . If memory is big enough or conversely the file is small enough to do
  1090.         the sort in memory, in one pass, then the sort will be optimally fast.
  1091.  
  1092.       . Otherwise the input must be sorted a chunk at a time with the chunks
  1093.         being written to a temp file.  Then one or more merge phases will be
  1094.         required to combine the chunks.  If memory is very small and many
  1095.         merge phases are required, RPSORT would slow down dramatically.
  1096.  
  1097.       The following pages contain a lot of nitty gritty detail about the
  1098.       conditions which force RPSORT to use temp disk space and how much temp
  1099.       disk space it might need.  You can ignore these details if your
  1100.       situation meets either of the following conditions:
  1101.  
  1102.       . No temp files are needed if the free memory (see "Using CHKDSK Or MEM
  1103.         To Determine Free Memory" below) equals the input size plus twice the
  1104.         line/record count plus 70,000.  A 10,000 line 400,000 byte file
  1105.         requires 400,000 plus (2 * 10,000) plus 70,000 or a total of 490,000
  1106.         bytes of free memory to sort the input without using temp disk space.
  1107.  
  1108.       . If the drive assigned to hold temp files (either the default drive or
  1109.         the drive specified in the /T switch) has twice as much space as the
  1110.         size of the input file, this will always be sufficient.
  1111.  
  1112.  
  1113.       Using CHKDSK Or MEM To Determine Free Memory
  1114.  
  1115.         To determine the amount of free memory in your system, use the CHKDSK
  1116.         command which gives you a display something like:
  1117.  
  1118.                 362496 bytes total disk space
  1119.                  53248 bytes in 2 hidden files
  1120.                 303104 bytes in 36 user files
  1121.                   6144 bytes available on disk
  1122.  
  1123.                 655360 bytes total memory
  1124.                 581168 bytes free
  1125.  
  1126.         The free memory is on the last line (581168 in this example).  If you
  1127.         own MS-DOS 5.0 you can use the MEM command and get something like:
  1128.  
  1129.                 655360 bytes total conventional memory
  1130.                 655360 bytes available to MS-DOS
  1131.                 564288 largest executable program size
  1132.  
  1133.         Here the free memory appears on the "largest executable program size"
  1134.         line (564288 in this case).
  1135.  
  1136.  
  1137.  
  1138.   September 17, 1991           RPSORT Reference                      Page  19
  1139.  
  1140.  
  1141.   Efficiency Considerations (continued)
  1142.     How Memory Size Affects RPSORT Speed And Need For Temp Disk Space (cont.)
  1143.  
  1144.       Sorts Requiring No Merge Phase And No Temporary Files
  1145.  
  1146.         If possible, RPSORT will do a sort in a single pass without requiring
  1147.         any temporary files.  Use the following steps to determine whether a
  1148.         given file can be sorted in a single pass:
  1149.  
  1150.         . First determine the amount of free memory (called FREEMEM below).
  1151.           See "Using CHKDSK Or MEM To Determine Free Memory" above.
  1152.  
  1153.         . Then the memory space required, by RPSORT, for the input equals:
  1154.  
  1155.             File Size  +  Twice The Number Of Records/Lines In The File
  1156.  
  1157.           This sum is called FILESPACE below.  For example, if the file size
  1158.           were 453,868 bytes and it consisted of 8,323 lines then FILESPACE
  1159.           would equal 453,868 + 8,323 + 8,323 or 470,514 bytes.
  1160.  
  1161.         . RPSORT also requires some memory for itself and for buffers and
  1162.           tables.  This depends on the size of FREEMEM:
  1163.  
  1164.           . If FREEMEM exceeds 170,000 bytes RPSORT reserves 70,000 bytes.
  1165.             In this case, a file can be sorted in one pass if:
  1166.  
  1167.               FILESPACE  is less than    FREEMEM - 70,000
  1168.  
  1169.           . If FREEMEM is less than 170,000 bytes then RPSORT reserves 18,000
  1170.             bytes plus one-third of the remainder of FREEMEM for itself.
  1171.             This means that a file can be sorted in a single pass if:
  1172.  
  1173.                                            2 * (FREEMEM - 18,000)
  1174.               FILESPACE  is less than      ----------------------
  1175.                                                       3
  1176.  
  1177.           . If FREEMEM is less than approximately 30,000 bytes, then RPSORT
  1178.             will be unable to do the sort at all.
  1179.  
  1180.  
  1181.  
  1182.   September 17, 1991           RPSORT Reference                      Page  20
  1183.  
  1184.  
  1185.   Efficiency Considerations (continued)
  1186.     How Memory Size Affects RPSORT Speed And Need For Temp Disk Space (cont.)
  1187.  
  1188.       Sorts Requiring One Merge Phase And One Temporary File
  1189.  
  1190.         When a single pass sort is not possible, RPSORT breaks up the file
  1191.         into "chunks" and sorts each chunk separately.  Then it merges these
  1192.         chunks to produce the sorted output.  Use the following steps to
  1193.         check whether a file can be sorted with a single merge phase using
  1194.         only a single temporary file the same size as the input file:
  1195.  
  1196.         . Compute FREEMEM and FILESPACE as described in the previous section.
  1197.  
  1198.         . Then compute the number of chunks (called #CHUNKS below) as
  1199.           follows and round up to the next higher integer:
  1200.  
  1201.           . If FREEMEM exceeds 170,000 bytes then:
  1202.  
  1203.                               FILESPACE
  1204.                #CHUNKS  =  ----------------
  1205.                            FREEMEM - 70,000
  1206.  
  1207.           . If FREEMEM is less than 170,000 then:
  1208.  
  1209.                               3 * FILESPACE
  1210.                #CHUNKS  =  ----------------------
  1211.                            2 * (FREEMEM - 18,000)
  1212.  
  1213.         . Now compute the maximum number of chunks that RPSORT can merge at
  1214.           one time (called MAXMERGE below) as follows and round down to the
  1215.           next lower integer:
  1216.  
  1217.           . If FREEMEM exceeds 315,000 then:
  1218.  
  1219.                             FREEMEM - 50,000
  1220.                MAXMERGE  =  ----------------
  1221.                                  16,000
  1222.  
  1223.           . If FREEMEM exceeds 90,000 but is less than 315,000 then:
  1224.  
  1225.                MAXMERGE  =  16
  1226.  
  1227.           . If FREEMEM is less than 90,000 then:
  1228.  
  1229.                             8 * (FREEMEM - 18,000)
  1230.                MAXMERGE  =  ----------------------
  1231.                                    36,000
  1232.  
  1233.         . If #CHUNKS is less than or equal to MAXMERGE, then RPSORT will do a
  1234.           single merge phase sort using a single temp file the same size as
  1235.           the input file.
  1236.  
  1237.  
  1238.  
  1239.   September 17, 1991           RPSORT Reference                      Page  21
  1240.  
  1241.  
  1242.   Efficiency Considerations (continued)
  1243.     How Memory Size Affects RPSORT Speed And Need For Temp Disk Space (cont.)
  1244.  
  1245.       Sorts Requiring Two Or More Merge Phases And Two Temporary Files
  1246.  
  1247.         If necessary, RPSORT will do a multiple merge phase sort.  This
  1248.         requires two temporary files each the size of the input file.
  1249.  
  1250.         Actually, RPSORT doesn't abruptly go to a full second merge phase if
  1251.         it can't do the sort in one merge phase.  If #CHUNKS is less than
  1252.         twice MAXMERGE it does a one and a fraction merge phase sort.  The
  1253.         first temp file (TEMP1) will be the same size as the input but the
  1254.         second (TEMP2) will be smaller as follows:
  1255.  
  1256.                              #CHUNKS - MAXMERGE + 1
  1257.           Size of TEMP2  =   ----------------------  *  Size of input file
  1258.                                     #CHUNKS
  1259.  
  1260.  
  1261.     Deciding What Drives To Put Temporary And Output Files On
  1262.  
  1263.       Reading one file and writing another file concurrently on the same
  1264.       drive is generally inefficient because it requires that the drive head
  1265.       assembly constantly move back and forth between the two files.  This
  1266.       can slow things down significantly.
  1267.  
  1268.       RPSORT always finishes reading the input file before it starts writing
  1269.       the output file.  This means there is no loss of efficiency if the
  1270.       input and output are on the same drive.  Of course there must be enough
  1271.       room on this drive to hold the output file.
  1272.  
  1273.       If a sort requires temporary files they are written at the same time as
  1274.       the input file is read.  Similarly, temporary files are read at the
  1275.       same time as the output file is written.  The drive assigned for
  1276.       temporary files must have enough space to hold the entire input and in
  1277.       some cases twice that much.  Temp files go to the default drive but you
  1278.       can over-ride this with the /T switch.
  1279.  
  1280.       If you have a big enough RAM disk, you should consider putting the temp
  1281.       files there.  This could markedly enhance the performance of RPSORT.
  1282.  
  1283.       If you don't use a RAM disk, you should assign temp files to a drive
  1284.       other than the ones on which the input and output files reside.  This
  1285.       dictum is not absolute, however, as indicated by the following:
  1286.  
  1287.       . If you have only one hard drive and both the input and output files
  1288.         reside there, you are better off putting the temp files on the same
  1289.         hard drive than on a floppy.
  1290.  
  1291.       . If you are short of disk space, putting the temp files and the output
  1292.         file on the same drive could help because the output file might be
  1293.         able to reuse part of the space allocated to temp files.
  1294.  
  1295.  
  1296.  
  1297.   September 17, 1991           RPSORT Reference                      Page  22
  1298.  
  1299.  
  1300.   Efficiency Considerations (continued)
  1301.  
  1302.     Buffers Command In Your Config.Sys
  1303.  
  1304.       MS-DOS allocates disk buffers in memory to support read and write
  1305.       operations.  The buffers are usually 512 bytes each.  MS-DOS allocates
  1306.       10 or 15 buffers depending on whether your system has less or more than
  1307.       512K of memory.  Some applications run faster with a larger number of
  1308.       buffers.  You specify this in your config.sys file.  For example:
  1309.  
  1310.         BUFFERS=30
  1311.  
  1312.       On my computer (a 10Mhz 286 with a slow hard disk):
  1313.  
  1314.       . Sorting a modest size files (say up to a megabyte) speeds up little
  1315.         if at all when I increase the number of buffers.
  1316.  
  1317.       . Sorting a large file (say a few megabytes), speeds up a very few
  1318.         percent with BUFFERS=20.
  1319.  
  1320.       . BUFFERS=30 produces an additional small improvement for very large
  1321.         files (upwards of ten megabytes).
  1322.  
  1323.       To fine tune the performance of RPSORT on your system, sort files of
  1324.       the type and size typical for you and test the effect various BUFFER
  1325.       values.  In any case, you probably will use the number of buffers that
  1326.       is optimal for your principal applications not for RPSORT.
  1327.  
  1328.  
  1329.     Using Disk Cache Programs
  1330.  
  1331.       Disk cache programs (like SMARTDRV.SYS which is distributed as part of
  1332.       MS-DOS 5.0 package) set aside an area of memory called the disk cache.
  1333.       Typically the disk cache is allocated in expanded or extended memory
  1334.       and may be quite large (i.e. a megabyte or more).
  1335.  
  1336.       Disk cache programs intercept accesses to disk and retain data from
  1337.       the disk, in the cache.  If the data is required later on, the disk
  1338.       cache program can provide the data from memory rather than having to go
  1339.       to the disk drive which would be much slower.
  1340.  
  1341.       If the retained data is needed often enough then the performance of
  1342.       your system will improve.  Otherwise, your system may slow down due to
  1343.       the overhead of the disk cache program.
  1344.  
  1345.       I can't make any definitive statement as to how disk cache programs
  1346.       might improve or degrade the performance of your system.
  1347.  
  1348.       If you contemplate using a disk cache program, I suggest that you
  1349.       perform experiments with caches of different sizes and possibly with
  1350.       different cache programs.  These experiments should include the entire
  1351.       range of activities you perform on your system.
  1352.  
  1353.  
  1354.  
  1355.   September 17, 1991           RPSORT Reference                      Page  23
  1356.  
  1357.  
  1358.   Special Situations
  1359.  
  1360.     Sorting Files That Contain Tabs
  1361.  
  1362.       If your input file contains tabs and if the tabs must be expanded to
  1363.       the proper number of spaces for your sort keys to line up properly,
  1364.       then RPSORT will not sort it correctly because RPSORT does not expand
  1365.       the tabs.  The solution is to process the file with some program that
  1366.       expands the tabs and then to use the output of this program as the
  1367.       input to RPSORT.
  1368.  
  1369.       As a convenience, for those who face this problem, I have included a
  1370.       program called RPTAB in this package.  The syntax for RPTAB is:
  1371.  
  1372.         RPTAB  input-filespec  output-filespec  [tabstop...]
  1373.  
  1374.       The parameters must be given in the indicated order.
  1375.  
  1376.       The input is a file containing tabs to be expanded.  After RPTAB does
  1377.       its thing, the contents of the output file will be the same as that of
  1378.       the input except that all tabs will have been replaced by the number of
  1379.       spaces required to reach the next tab stop.
  1380.  
  1381.       Specifying tab stops is optional.  If you don't specify any, the
  1382.       default tab stops are at positions 1, 9, 17, 25, 33... and so on at
  1383.       intervals of eight columns.  The following command will expand tabs to
  1384.       the default tab stops:
  1385.  
  1386.         RPTAB   MYTABS.DAT   MYSPACES.DAT
  1387.  
  1388.       If you specify tab stops they must be a sequence of integers each
  1389.       greater than the preceding one.  The first tab stop is always at column
  1390.       1 and you need not specify it.  RPTAB follows the rule that the
  1391.       interval between the last two specified tab stops implies subsequent
  1392.       tab stops at the same interval.  The command:
  1393.  
  1394.         RPTAB   MYTABS.DAT   MYSPACES.DAT   6  15  27
  1395.  
  1396.       tells RPTAB that the tab stops are at positions 1, 6, 15, 27, 39, 51...
  1397.       etc.  The interval of 12 between 15 and 27 is propagated to subsequent
  1398.       tab stops.
  1399.  
  1400.       This package includes the file RPTAB.PAS which is the complete source
  1401.       code for RPTAB.  RPTAB is written in Turbo Pascal and compiled with
  1402.       version 6.0 of that compiler.  If you want to improve or modify RPTAB
  1403.       in any way, please feel free to do so.  Please! Please! do not
  1404.       distribute any modified version under my name.  If you did it, you
  1405.       deserve the credit.
  1406.  
  1407.       RPTAB.PAS consists of Pascal statements and an assembly language
  1408.       sub-routine called ExpandTabs.  This latter was written using Turbo
  1409.       Pascal's inline assembler (a very useful addition by Borland).
  1410.  
  1411.  
  1412.  
  1413.   September 17, 1991           RPSORT Reference                      Page  24
  1414.  
  1415.  
  1416.   Special Situations (continued)
  1417.  
  1418.     Writing The Output To The File That Contained The Input
  1419.  
  1420.       Nothing stops you from specifying the same file as both input and
  1421.       output in a RPSORT command.  It is dangerous but it can be beneficial
  1422.       in some circumstances.
  1423.  
  1424.       It is possible to do this is because RPSORT never starts writing the
  1425.       output file until after it has finished reading the input file.
  1426.       Therefore it will not destroy the input before it has read it.
  1427.  
  1428.       The danger is that after RPSORT has started writing the output file but
  1429.       before it has finished, your system may go down due possibly to a power
  1430.       failure or a software or hardware problem or whatever.  In this case
  1431.       the input would be destroyed and the output would not yet exist.  This
  1432.       would mean the loss of your data unless you had backed up your file or
  1433.       it could be recreated in some way.
  1434.  
  1435.       The benefit is realized when you must put the output file on the same
  1436.       drive as the input file but there is not enough space, on the drive, to
  1437.       hold both.  By using the same file for input as for output you would
  1438.       re-use the same disk space and thus might be able to do a sort that
  1439.       otherwise you could not do.  Once again, don't do this unless you have
  1440.       backed up your data or you have some relatively easy way to recover it.
  1441.  
  1442.       None of the above applies if RPSORT is being used as a filter.  In that
  1443.       case if the output file is the same as the input then the input file
  1444.       will be destroyed by DOS before RPSORT even starts executing.
  1445.  
  1446.   Two Incompatibilities With The DOS SORT
  1447.  
  1448.     Their are two exceptions to the statement that any command that works
  1449.     with the DOS SORT will produce the same result with RPSORT:
  1450.  
  1451.     . RPSORT will not let you type the input file from the keyboard.
  1452.  
  1453.     . The DOS SORT tacks the CRLF, that ends a line, onto the sort key.
  1454.       RPSORT doesn't.  Thus, RPSORT sorts null lines to the beginning of a
  1455.       file.  The DOS SORT precedes them with any line whose sort key starts
  1456.       with a character like tab or formfeed whose ASCII value is less than
  1457.       that for CR.
  1458.  
  1459.  
  1460.  
  1461.   September 17, 1991           RPSORT Reference                      Page  25
  1462.  
  1463.  
  1464.   Error Messages
  1465.  
  1466.     Error Numbers And Return Codes
  1467.  
  1468.       Each type of error that RPSORT can detect has been assigned an error
  1469.       number which appears in the corresponding error message.  For example:
  1470.  
  1471.         ERROR 049: No room on disk to write sorted output file.
  1472.  
  1473.       When RPSORT terminates, it sets the "errorlevel" return code as follows:
  1474.  
  1475.       . If the sort was successful, RPSORT sets the return code to zero.
  1476.  
  1477.       . If one or more syntax errors are discovered,  the relevant error
  1478.         messages are displayed and the sort is terminated.  The return code
  1479.         is set to the error number for the first error detected.
  1480.  
  1481.       . If an error is discovered while executing the sort (typically some
  1482.         kind of input, output or insufficient memory error), the appropriate
  1483.         error message is displayed and the return code is set to the error
  1484.         number for that error.
  1485.  
  1486.         The error numbers are broken down into groups as follows:
  1487.  
  1488.           Error Number Group        Range Of Error Numbers
  1489.           ----------------------    ----------------------
  1490.           Syntax Errors                      1 - 34
  1491.           DOS Version Before 2.0                 37
  1492.           Insufficient Memory               40 - 41
  1493.           Line/String Too Long Errors       43 - 44
  1494.           Input/Output Errors               46 - 54
  1495.  
  1496.          There are also a number of error messages with error numbers in the
  1497.          range 59 through 74 which should never happen.  Any of these could
  1498.          imply a bug in RPSORT.
  1499.  
  1500.          If you run RPSORT from a batch file, you can test the return codes
  1501.          in statements like:
  1502.  
  1503.            IF  ERRORLEVEL  1  GOTO SORTERR
  1504.  
  1505.          This would catch any return code greater than or equal to one and
  1506.          thus any error at all.  Another example:
  1507.  
  1508.            IF  ERRORLEVEL  40  GOTO EXECERR
  1509.  
  1510.          This would catch any return code greater than or equal to 40 and
  1511.          thus any sort execution error.
  1512.  
  1513.  
  1514.  
  1515.   September 17, 1991           RPSORT Reference                      Page  26
  1516.  
  1517.  
  1518.   Error Messages (continued)
  1519.  
  1520.     Syntax Error Messages
  1521.  
  1522.       When RPSORT parses the command line it displays messages for any syntax
  1523.       errors it finds.  It always parses the complete command line and
  1524.       therefore may report several errors.  Many error messages display the
  1525.       bad parameter at the end of the message.  For example:
  1526.  
  1527.         ERROR 019: Only one keylength allowed: "/13:5:7"
  1528.  
  1529.       In the message listing below, the quoted word "badparm" stands for the
  1530.       bad parameter that RPSORT is complaining about.
  1531.  
  1532.       RPSORT never executes the sort if it finds syntax errors but instead
  1533.       terminates immediately after displaying the last error message.
  1534.  
  1535.       The list of syntax error messages follows:
  1536.  
  1537.       ERROR 001: Slash (/) must be followed by a parameter.
  1538.  
  1539.         A slash was followed by a space.  Slash must always be followed by
  1540.         one of the switch characters or it must start a sort key definition.
  1541.  
  1542.       ERROR 002: Illegal parameter: "badparm"
  1543.  
  1544.         This message is displayed when RPSORT finds an illegal parameter but
  1545.         can't figure out a more specific error to cite.  It lists this
  1546.         message and the bad parameter that it objects to.
  1547.  
  1548.       ERROR 003: Only one /X switch is allowed.
  1549.  
  1550.         /X in this message will either be /F, /E or /T.  Each of these
  1551.         switches may only be specified once in an RPSORT command.
  1552.  
  1553.       ERROR 004: /P and /C are incompatible.
  1554.  
  1555.         /P and /C are mutually exclusive.  /P says that all character string
  1556.         sort keys are Pascal style strings while /C says that all character
  1557.         string sort keys are C language style strings.  There is no way a
  1558.         character string can be both of these.
  1559.  
  1560.       ERROR 005: Record len must be between 1 and 32,750 in: "badparm"
  1561.  
  1562.         "badparm" is a /Fnnnn switch specifying a record length that is
  1563.          either zero or greater than 32750.  This is not allowed.
  1564.  
  1565.       ERROR 006: Pascal string key only allowed in fixed len record: "badparm"
  1566.  
  1567.         "badparm" is a sort key definition specifying a Pascal style string
  1568.         (i.e. including the P attribute).  This is only allowed if a /Fnnnn
  1569.         switch was specified to tell RPSORT that the file consists of fixed
  1570.         length records.
  1571.  
  1572.  
  1573.  
  1574.   September 17, 1991           RPSORT Reference                      Page  27
  1575.  
  1576.  
  1577.   Error Messages (continued)
  1578.     Syntax Error Messages (continued)
  1579.  
  1580.       ERROR 007: /P only allowed for fixed length records.
  1581.  
  1582.         The /P switch which says that all character string sort keys are
  1583.         Pascal style sort keys is only allowed if a /Fnnnn switch was
  1584.         specified to tell RPSORT that the file consists of fixed length
  1585.         records.
  1586.  
  1587.       ERROR 008: Binary number key (F,I,M,T or U) only allowed in fixed len
  1588.                  record: "badparm"
  1589.  
  1590.         "badparm" is a sort key definition listing one of the binary number
  1591.         attributes.  These are only allowed if a /Fnnnn switch was specified
  1592.         to tell RPSORT that the file consists of fixed length records.
  1593.  
  1594.       ERROR 009: /N switch not allowed for fixed length records.
  1595.  
  1596.         The /N switch, which says that null lines are to be deleted, is only
  1597.         allowed for a file consisting of lines.  It is not allowed if a
  1598.         /Fnnnn switch has been specified.
  1599.  
  1600.       ERROR 010: One and only one temp drive letter may be entered: "badparm"
  1601.  
  1602.         "badparm" is a /T switch specifying either no drive letters or more
  1603.         than one.  It should list only a single drive to be used for
  1604.         temporary files (e.g. /TC).
  1605.  
  1606.       ERROR 011: Non-existent drive: "badparm"
  1607.  
  1608.         "badparm" is a /T switch specifying a drive letter that does not
  1609.         exist in your system.
  1610.  
  1611.       ERROR 012: Invalid character for the drive: "badparm"
  1612.  
  1613.         "badparm" is a /T switch specifying a non-alphabetic drive.  A drive
  1614.         can only be specified by a letter.
  1615.  
  1616.       ERROR 013: Start column must be between 1 and 32,750: "badparm"
  1617.  
  1618.         "badparm" is a sort key definition specifying a start column that is
  1619.         either zero or larger than 32750.  This is not allowed.
  1620.  
  1621.       ERROR 014: Start column must not exceed record len: "badparm"
  1622.  
  1623.         "badparm" is a sort key definition specifying a start column that is
  1624.         larger than the record length in the /Fnnnn switch.  This is not
  1625.         allowed.
  1626.  
  1627.  
  1628.  
  1629.   September 17, 1991           RPSORT Reference                      Page  28
  1630.  
  1631.  
  1632.   Error Messages (continued)
  1633.     Syntax Error Messages (continued)
  1634.  
  1635.       ERROR 015: Only one start column allowed: "badparm"
  1636.  
  1637.         "badparm" is a sort key definition that specifies more than one start
  1638.         column for the sort key.  This is not allowed.
  1639.  
  1640.       ERROR 016: Error in sort key: "badparm"
  1641.  
  1642.         "badparm" is an erroneous sort key definition.  RPSORT is unable to
  1643.         cite a more specific error.
  1644.  
  1645.       ERROR 017: Key len must be between 1 and 32,750: "badparm"
  1646.  
  1647.         "badparm" is a sort key definition specifying a key length that is
  1648.         either zero or larger than 32750.  This is not allowed.
  1649.  
  1650.       ERROR 018: Key len is too big to fit in record: "badparm"
  1651.  
  1652.         "badparm" is a sort key definition containing a key length that would
  1653.         cause the key to extend beyond the end of the record as specified by
  1654.         the /Fnnnn switch.
  1655.  
  1656.       ERROR 019: Only one key length allowed: "badparm"
  1657.  
  1658.         "badparm" is a sort key definition that specifies more than one key
  1659.         length for the sort key.  This is not allowed.
  1660.  
  1661.       ERROR 020: Length for 80x87 floating point number must be 4, 8 or
  1662.                  10: "badparm"
  1663.  
  1664.         "badparm" is a sortkey definition specifying an 80x87 type floating
  1665.         point number (attribute F).  The key length (either explicit or the
  1666.         implied key length to the end of the record) is not one of the
  1667.         legitimate values (4, 8 or 10).
  1668.  
  1669.       ERROR 021: Length for GWBASIC/BASICA floating point number must be 4 or
  1670.                  8: "badparm"
  1671.  
  1672.         "badparm" is a sortkey definition specifying a GWBASIC/BASICA type
  1673.         floating point number (attribute M).  It key length (either explicit
  1674.         or the implied key length to the end of the record) is not one of the
  1675.         legitimate values (4 or 8).
  1676.  
  1677.       ERROR 022: Length for Turbo Pascal floating point number must be
  1678.                  6: "badparm"
  1679.  
  1680.         "badparm" is a sortkey definition specifying a Turbo Pascal type
  1681.         floating point number (attribute T).  It specifies a key length other
  1682.         than 6 which is the only legitimate value.  It is not necessary to
  1683.         specify a key length for Turbo Pascal floating point numbers because
  1684.         RPSORT assumes the length 6 by default.
  1685.  
  1686.  
  1687.  
  1688.   September 17, 1991           RPSORT Reference                      Page  29
  1689.  
  1690.  
  1691.   Error Messages (continued)
  1692.     Syntax Error Messages (continued)
  1693.  
  1694.      ERROR 023: Length for Pascal strings must be between 2 and 256: "badparm"
  1695.  
  1696.         "badparm" is a sortkey definition specifying a Turbo Pascal type
  1697.         string (attribute P).  It specifies a key length less than 2 or more
  1698.         than 256 which are the limits for this type of string and correspond
  1699.         to string[1] and string[255] respectively.
  1700.  
  1701.       ERROR 024: Length for Pascal strings must be between 2 and 256.
  1702.  
  1703.         The /P switch was specified telling RPSORT that all character string
  1704.         type sort keys were Turbo Pascal style strings but at least one of
  1705.         the character string sort key definitions gave a key length less than
  1706.         2 or more than 256. Alternatively, one of them had no explicit key
  1707.         length but the implied key length to the end of the record was not in
  1708.         the required range.
  1709.  
  1710.       ERROR 025: "P" and "C" attributes are incompatible: "badparm"
  1711.  
  1712.         "badparm" is a sort key definition that specifys both the P and C
  1713.         attributes,  thus saying that the sort key is both a Pascal style
  1714.         string and a C style string.  This is not possible.
  1715.  
  1716.       ERROR 026: C attribute conflicts with /P: "badparm"
  1717.         or
  1718.       ERROR 026: P attribute conflicts with /C: "badparm"
  1719.  
  1720.         "badparm" is a sort key definition that specifys the C or P attribute.
  1721.         This conflicts with the opposite /P or /C switch thus implying that
  1722.         the sort key is both a C style string and a P style string.  This is
  1723.         not possible.
  1724.  
  1725.       ERROR 027: Sort key cannot be both a binary number and a
  1726.                  string: "badparm"
  1727.  
  1728.         "badparm" is a sort key definition specifying one of the attributes
  1729.         (A, C or P) appropriate to a character string key and also one of the
  1730.         attributes (F, I, M, T, U) appropriate to a binary number key.  This
  1731.         is not allowed.
  1732.  
  1733.       ERROR 028: Only one binary key type allowed in a sort key: "badparm"
  1734.  
  1735.         "badparm" is a sort key definition which includes more than one of
  1736.         the binary number attributes (F, I, M, T, U).  A sort key can't be
  1737.         two different kinds of numbers.
  1738.  
  1739.  
  1740.  
  1741.   September 17, 1991           RPSORT Reference                      Page  30
  1742.  
  1743.  
  1744.   Error Messages (continued)
  1745.     Syntax Error Messages (continued)
  1746.  
  1747.       ERROR 029: Only one list of input files and a single output file may be
  1748.                  given.  Found additional file spec: "badparm"
  1749.  
  1750.         "badparm" is the third filespec or list of filespecs listed in the
  1751.         command line.  The first filespec or list of filespecs separated by
  1752.         plus signs is taken to be the input.  Then there should be a single
  1753.         filespec for the output.  For example:
  1754.  
  1755.           RPSORT  INPUT1.DAT+INPUT2.DAT  OUTPUT.DAT
  1756.  
  1757.         No additional filespec is not allowed.
  1758.  
  1759.       ERROR 030: Multiple files not allowed in output spec: "badparm"
  1760.  
  1761.         The first filespec or list of filespecs separated by plus signs is
  1762.         taken to the input.  Subsequently, in the command line, you would
  1763.         enter the output filespec.  This must be a single file.
  1764.  
  1765.       ERROR 031: Misplaced plus sign in input file list: "badparm"
  1766.  
  1767.         The list of files you specify for the input must be separated by plus
  1768.         signs.  There must be no spaces around the plus signs and there must
  1769.         be no plus sign before the first filespec or after the last filespec
  1770.         in the list.
  1771.  
  1772.       ERROR 032: Input is redirected from the standard input, output must go
  1773.        to the standard output.  The following file spec is illegal: "badparm"
  1774.  
  1775.         You redirected the standard input to a file.  In this case the
  1776.         output must also go to the standard output.  This can either be to
  1777.         the screen by default or can be redirected to a file.
  1778.  
  1779.       ERROR 033: You must specify an input file.
  1780.  
  1781.         You did not specify an input file either explicitly or by redirecting
  1782.         the standard input to a file.  RPSORT insists that its input come
  1783.         from a file specified in one of these two ways.
  1784.  
  1785.       ERROR 034: No name specified for error file: "badparm"
  1786.  
  1787.         "badparm" is a /E switch that did not include a file name.  The /E
  1788.         switch must include a file name.  For example:  /ESORTERRS.TXT
  1789.  
  1790.  
  1791.  
  1792.   September 17, 1991           RPSORT Reference                      Page  31
  1793.  
  1794.  
  1795.   Error Messages (continued)
  1796.  
  1797.     DOS Version Before 2.0 Message
  1798.  
  1799.       ERROR 037: RPSORT requires MS DOS version 2.00 or later.
  1800.  
  1801.         RPSORT uses MS-DOS functions that were added in version 2.0 and
  1802.         therefore can not run with an earlier version.
  1803.  
  1804.  
  1805.     Insufficient Memory Messages
  1806.  
  1807.       ERROR 040: Not enough memory.  RPSORT requires 30,000 bytes.
  1808.  
  1809.         RPSORT can run in very small amounts of memory but there is a limit.
  1810.  
  1811.       ERROR 041: Not enough memory to hold at least two records/lines at a
  1812.                  time.
  1813.  
  1814.         If the records or lines in your file are large, you may need more
  1815.         available memory than the basic 30K RPSORT usually requires.  You
  1816.         need room to hold at least two lines or records at a time plus you
  1817.         need memory to hold the RPSORT program and a few tables and other
  1818.         odds and ends.  In the extreme case where your lines or records are
  1819.         32000 bytes each, you might need some 90K of memory to run RPSORT.
  1820.  
  1821.     Line Or String Too Long Messages
  1822.  
  1823.       ERROR 043: Line exceeds max length of 32750 bytes.
  1824.  
  1825.         RPSORT found a line in the file that exceeded the  maximum allowed
  1826.         length of 32750 bytes.
  1827.  
  1828.       ERROR 044: Found Pascal string whose length byte exceeds specified key
  1829.                  length.
  1830.  
  1831.         The binary number in the first byte of a Pasal string (the length
  1832.         byte) must be less than the length attribute specified in the sort
  1833.         key definition.  Otherwise, the string would extend beyond the end
  1834.         of the key.
  1835.  
  1836.  
  1837.  
  1838.   September 17, 1991           RPSORT Reference                      Page  32
  1839.  
  1840.  
  1841.   Error Messages (continued)
  1842.  
  1843.     Input/Output Error Messages
  1844.  
  1845.       ERROR 046: No data in input file(s) so nothing to do.
  1846.  
  1847.         There was no data in the input file(s).  Either the size of the input
  1848.         file(s) was zero or the first byte of each input file was a Ctrl-Z
  1849.         thus terminating the input file(s) at the very beginning.
  1850.  
  1851.       ERROR 047: Input file not found: filename
  1852.  
  1853.         The input file named by "filename" was not found.  Check the spelling
  1854.         of the name or add a path if appropriate.
  1855.  
  1856.       ERROR 048: Error reading input file.
  1857.  
  1858.         Normally you would not see this error message from RPSORT.  Usually
  1859.         if there is an uncorrectable error while reading a disk, DOS will
  1860.         tell you and then prompt you to specify:
  1861.  
  1862.          Abort, Retry, Ignore, Fail
  1863.  
  1864.         Typically you would try R for retry a few times to see if it can get
  1865.         past the error.  If not, you would probably enter A for abort and
  1866.         RPSORT would never know what happened since DOS would terminate it.
  1867.  
  1868.         If, however, you entered F for fail then DOS would return this info
  1869.         to RPSORT and RPSORT would display the ERROR 048 message.
  1870.  
  1871.         If you were to enter I for ignore then DOS would return to RPSORT
  1872.         with no indication that the read had failed.  RPSORT would assume
  1873.         that data from the file had actually been read into memory.  This
  1874.         data would be garbage but RPSORT would happily sort the garbage and
  1875.         produce a meaningless output file.
  1876.  
  1877.       ERROR 049: No room on disk to write sorted output file.
  1878.  
  1879.         There is not enough space on the drive you assigned for the output
  1880.         file to hold the latter.
  1881.  
  1882.       ERROR 050: No room on disk to write temp file.
  1883.  
  1884.         The drive you assigned for RPSORT temporary files has insufficient
  1885.         space to hold them.
  1886.  
  1887.       ERROR 051: Unable to create temp file.
  1888.  
  1889.         There was an error attempting to create a temporary file.  Probably,
  1890.         the disk you assigned to hold temporary files doesn't have enough
  1891.         directory entries available in the current directory.  RPSORT may
  1892.         require up to three directory entries for temporary files.
  1893.  
  1894.  
  1895.  
  1896.   September 17, 1991           RPSORT Reference                      Page  33
  1897.  
  1898.  
  1899.   Error Messages (continued)
  1900.     Input/Output Error Messages (continued)
  1901.  
  1902.       ERROR 052: Unable to create output file.
  1903.  
  1904.         There was an error attempting to create the output file.  Probably,
  1905.         the drive and directory you assigned to the output file doesn't have
  1906.         any directory entries available.
  1907.  
  1908.       ERROR 053: Unable to create error file: "badparm"
  1909.  
  1910.         There was an error attempting to create the error message file.
  1911.         Probably, the drive and directory you assigned to the error file
  1912.         doesn't have any directory entries available.
  1913.  
  1914.       ERROR 054: Ran out of space on disk attempting to write error file.
  1915.                  Redirecting error messages to the screen.
  1916.  
  1917.         There is not enough space on the drive you assigned for the error
  1918.         message file to hold the latter.  RPSORT displays the current and any
  1919.         subsequent error messages to the screen before terminating.
  1920.  
  1921.  
  1922.     Never Should Happen Error Messages
  1923.  
  1924.       At a number of points, in RPSORT, I check for errors resulting from the
  1925.       use of DOS functions under conditions where in principle no errors
  1926.       could occur.  Any such errors would imply the possibility of a bug in
  1927.       RPSORT. There would also be the possibility of a bug in MS-DOS.
  1928.  
  1929.       If any of these error messages are displayed, please  send me a precise
  1930.       description of the circumstances.  This would include the amount of
  1931.       memory available in your system (the amount reported by CHKDSK or MEM
  1932.       not the total amount), the size of the file in bytes and the count of
  1933.       records or lines, whether the file consists of fixed length records or
  1934.       lines and the kind of sort key(s) you were using.
  1935.  
  1936.       ERROR 059: Error allocating memory.
  1937.  
  1938.         An error occurred using memory allocation functions in MS-DOS.
  1939.  
  1940.       ERROR 060: Unknown error accessing disk.
  1941.         through
  1942.       ERROR 074: Unknown error accessing disk.
  1943.  
  1944.         These messages all have the same text, but the error number would
  1945.         tell me where in the program the error occurred.  All of these have
  1946.         to do with disk I/O.
  1947.  
  1948.  
  1949.